load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("//:java_lite_proto_cel_library.bzl", "java_lite_proto_cel_library")
load("//:java_lite_proto_cel_library_impl.bzl", "java_lite_proto_cel_library_impl")

package(
    default_applicable_licenses = [
        "//:license",
    ],
    default_testonly = True,
    default_visibility = [
        "//testing/protos:__pkg__",
    ],
)

proto_library(
    name = "single_file_proto",
    srcs = ["single_file.proto"],
)

java_proto_library(
    name = "single_file_java_proto",
    tags = [
    ],
    deps = [":single_file_proto"],
)

proto_library(
    name = "multi_file_proto",
    srcs = [
        "multi_file.proto",
    ],
    deps = [":single_file_proto"],
)

proto_library(
    name = "message_with_enum_proto",
    srcs = ["message_with_enum.proto"],
)

java_proto_library(
    name = "message_with_enum_java_proto",
    deps = [":message_with_enum_proto"],
)

# Test only. java_proto_library supports generating a jar with multiple proto deps,
# so we must test this case as well for lite descriptors.
# buildifier: disable=LANG_proto_library-single-deps
java_proto_library(
    name = "multi_file_java_proto",
    deps = [
        ":multi_file_proto",
        ":single_file_proto",
    ],
)

java_lite_proto_cel_library(
    name = "multi_file_cel_java_proto_lite",
    deps = [
        ":multi_file_proto",
        ":single_file_proto",
    ],
)

java_lite_proto_cel_library(
    name = "test_all_types_cel_java_proto2_lite",
    deps = ["@cel_spec//proto/cel/expr/conformance/proto2:test_all_types_proto"],
)

java_lite_proto_cel_library(
    name = "test_all_types_cel_java_proto3_lite",
    deps = ["@cel_spec//proto/cel/expr/conformance/proto3:test_all_types_proto"],
)

# The below targets exist to exercise lite descriptor tests against the full protobuf runtime (thus the overridden java_proto_library_dep).
# Use cases outside CEL should follow the example above.

java_lite_proto_cel_library_impl(
    name = "multi_file_cel_java_proto",
    java_descriptor_class_suffix = "CelDescriptor",
    java_proto_library_dep = ":multi_file_java_proto",
    deps = [
        ":multi_file_proto",
        ":single_file_proto",
    ],
)

java_lite_proto_cel_library_impl(
    name = "test_all_types_cel_java_proto2",
    java_descriptor_class_suffix = "CelDescriptor",
    java_proto_library_dep = "@cel_spec//proto/cel/expr/conformance/proto2:test_all_types_java_proto",
    deps = ["@cel_spec//proto/cel/expr/conformance/proto2:test_all_types_proto"],
)

java_lite_proto_cel_library_impl(
    name = "test_all_types_cel_java_proto3",
    java_descriptor_class_suffix = "CelDescriptor",
    java_proto_library_dep = "@cel_spec//proto/cel/expr/conformance/proto3:test_all_types_java_proto",
    deps = ["@cel_spec//proto/cel/expr/conformance/proto3:test_all_types_proto"],
)

java_lite_proto_cel_library_impl(
    name = "message_with_enum_cel_java_proto",
    java_descriptor_class_suffix = "CelDescriptor",
    java_proto_library_dep = ":message_with_enum_java_proto",
    deps = [":message_with_enum_proto"],
)
